
use Diversification.dta, clear

* estimation

gen  GDPpcppp2= GDPpcppp* GDPpcppp

regress Gini GDPpcppp GDPpcppp2 
predict yg
regress HHI GDPpcppp GDPpcppp2
predict yh
regress T GDPpcppp GDPpcppp2
predict yt
regress  Nber GDPpcppp GDPpcppp2 
predict yn
lowess Nber GDPpcppp , generate(ynl)
lowess  T GDPpcppp , generate(ytl)

keep  GDPpcppp yg yh yt yn ynl ytl
sort GDPpcppp
label var  yg "Gini"
label var  yh "Herfindahl"
label var  yt "Theil index - quadratic"
label var  yn "Active lines - quadratic"
label var  ytl "Theil index - non parametric"
label var  ynl "Active lines - non parametric"

drop if GDPpcppp>60000
twoway (line yn GDPpcppp, lcolor(blue) lwidth(thick))(line ynl GDPpcppp, lcolor(blue) lwidth(thick) lpattern(dash))  (line ytl GDPpcppp, yaxis(2) lcolor(black) lwidth(thick)lpattern(dash))(line yt GDPpcppp, yaxis(2) lcolor(black) lwidth(thick)), ytitle(number of exported products) xtitle(GDP per capita PPP (constant 2005 international $)) ytitle(Theil index, axis(2)) legend(size(small)) plotregion(ifcolor(none))

